package com.ruoyi.web.controller.ai;


import com.ruoyi.common.ai.BaseResponse;
import com.ruoyi.common.ai.ResultUtils;
import com.ruoyi.system.domain.ChatRequest;
import com.ruoyi.system.domain.ChatResponse;
import com.ruoyi.system.service.WorkspaceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "工作空间接口")
@RestController
@RequestMapping("/workspace")
public class diaLogUeController {

    @Autowired
    private WorkspaceService workspaceService;

    @Operation(summary = "问答")
    @PostMapping(value = "/chat", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    public BaseResponse<ChatResponse> chat(@RequestBody ChatRequest chatRequest) {
        ResponseEntity<ChatResponse> response = workspaceService.getChat(chatRequest);
        return ResultUtils.success(response.getBody());
    }
}
